Skip to content

block: fix integrity offset/length conversions#745

Open
blktests-ci[bot] wants to merge 6 commits intolinus-master_basefrom
series/1077122=>linus-master
Open

block: fix integrity offset/length conversions#745
blktests-ci[bot] wants to merge 6 commits intolinus-master_basefrom
series/1077122=>linus-master

Conversation

@blktests-ci
Copy link
Copy Markdown

@blktests-ci blktests-ci Bot commented Apr 16, 2026

Pull request for series with
subject: block: fix integrity offset/length conversions
version: 2
url: https://patchwork.kernel.org/project/linux-block/list/?series=1081809

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 16, 2026

Upstream branch: d60bc14
series: https://patchwork.kernel.org/project/linux-block/list/?series=1081809
version: 2

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 16, 2026

Upstream branch: d60bc14
series: https://patchwork.kernel.org/project/linux-block/list/?series=1081809
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1077122=>linus-master branch from 7f265e9 to 1a93e79 Compare April 16, 2026 05:24
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 16, 2026

Upstream branch: d60bc14
series: https://patchwork.kernel.org/project/linux-block/list/?series=1081809
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1077122=>linus-master branch from 1a93e79 to bf9b1b5 Compare April 16, 2026 05:34
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 17, 2026

Upstream branch: d60bc14
series: https://patchwork.kernel.org/project/linux-block/list/?series=1082268
version: 3

@blktests-ci blktests-ci Bot added V3 and removed V2 labels Apr 17, 2026
@blktests-ci blktests-ci Bot force-pushed the series/1077122=>linus-master branch from bf9b1b5 to 85d88a1 Compare April 17, 2026 02:03
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 6b4d829 to ceec5ed Compare April 21, 2026 06:51
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 21, 2026

Upstream branch: b4e0758
series: https://patchwork.kernel.org/project/linux-block/list/?series=1082268
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1077122=>linus-master branch from 85d88a1 to d09e317 Compare April 21, 2026 06:54
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from ceec5ed to 3b54e52 Compare April 22, 2026 20:20
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 22, 2026

Upstream branch: 6596a02
series: https://patchwork.kernel.org/project/linux-block/list/?series=1082268
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1077122=>linus-master branch from d09e317 to ce676e8 Compare April 22, 2026 20:21
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 3b54e52 to 6a0b974 Compare April 23, 2026 16:58
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 23, 2026

Upstream branch: 507bd4b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1082268
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1077122=>linus-master branch from ce676e8 to d405649 Compare April 23, 2026 17:00
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 6a0b974 to 59ca59b Compare April 24, 2026 00:56
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 24, 2026

Upstream branch: dd6c438
series: https://patchwork.kernel.org/project/linux-block/list/?series=1082268
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1077122=>linus-master branch from d405649 to 74f7b87 Compare April 24, 2026 00:57
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch 2 times, most recently from 94f0438 to 857ada9 Compare April 24, 2026 07:54
bio_integrity_setup_default() and blk_integrity_iterate() set the
integrity seed (initial reference tag) to the absolute address in the
block device in units of 512-byte sectors. The seed is correctly
incremented/decremented in units of integrity intervals in
bio_integrity_map_iter(), bio_integrity_advance(), and
blk_integrity_interval(). As a result, the ref tag written or read to a
particular integrity interval on a block device with integrity interval
size > 512 bytes varies with the starting offset of the read/write.

Convert the initial seed to units of integrity intervals so a consistent
ref tag is used for each integrity interval.

Fixes: 3be91c4 ("block: Deprecate the use of the term sector in the context of block integrity")
Fixes: 63573e3 ("bio-integrity: Restore original iterator on verify stage")
Signed-off-by: Caleb Sander Mateos <[email protected]>
Reviewed-by: Anuj Gupta <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
bio_integrity_verify() expects the passed struct bvec_iter to be an
iterator over bio data, not integrity. So construct a separate data
bvec_iter without the bio_integrity_bytes() conversion and pass it to
bio_integrity_verify() instead of bip_iter.

Fixes: 0bde8a1 ("block: add fs_bio_integrity helpers")
Signed-off-by: Caleb Sander Mateos <[email protected]>
Reviewed-by: Anuj Gupta <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
To allow bio_integrity_intervals() to convert an absolute sector to an
absolute integrity interval, use u64 for its argument and return types.
Also use SECTOR_SHIFT instead of the magic constant 9.

Signed-off-by: Caleb Sander Mateos <[email protected]>
Reviewed-by: Anuj Gupta <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
bip_iter.bi_sector is meant to be in units of integrity intervals rather
than 512-byte sectors. bio_integrity_verify() doesn't actually use it
currently (it uses the passed in struct bvec_iter's bi_sector instead).
But let's set it to the expected value for consistency.

Signed-off-by: Caleb Sander Mateos <[email protected]>
Reviewed-by: Anuj Gupta <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Use bio_integrity_intervals() to convert blk_rq_pos(rq) to integrity
intervals to reduce code duplication.

Signed-off-by: Caleb Sander Mateos <[email protected]>
Reviewed-by: Anuj Gupta <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
bip_set_seed() and big_get_seed() take/return a sector_t value that's
actually an integrity interval number. This is confusing, so pass
struct bio instead to bip_set_seed() and convert the bio's device
address to integrity intervals.

Open-code the access to bip->bip_iter.bi_sector in the one caller of
bip_set_seed() that doesn't use the bio device address for the seed.
Open-code bip_get_seed() in its one caller.

Add a comment to struct bvec_iter's bi_sector field explaining its
alternate use for bip_iter.

Suggested-by: Christoph Hellwig <[email protected]>
Signed-off-by: Caleb Sander Mateos <[email protected]>
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 24, 2026

Upstream branch: dd6c438
series: https://patchwork.kernel.org/project/linux-block/list/?series=1082268
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1077122=>linus-master branch from 74f7b87 to b7ea5f4 Compare April 24, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant